#include <iostream>
#include <algorithm>
using namespace std;
const int M = 21100;
int a[M];
int main() {
    int N, B;
    cin >> N >> B;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(a, a + N);
    long long ans = 0;
    int count = 0;
    for(int i = N - 1; i >= 0; i--) {
        ans = (long long)(ans + a[i]);
        count++;
        if(ans >= B) {
            cout << count << endl;
            break;
        }
    }
    return 0;
}